#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QThread>
#include "jtools.h"


MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{

//    qDebug() << "MainWindow 构造";
//    JButton *btn1 = new JButton;
//    btn1->setText("Hello World J");
//    btn1->move(400,300);
//    btn1->resize(200,40);
//    btn1->setParent(this);
    // btn1->connect();

    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    //qDebug() << "MainWindow 析构";
    delete ui;
}


void MainWindow::on_loginDo_clicked()
{

// 暂停1秒
//    QThread::sleep(3);

//     qDebug() << "loginDo test" << endl;
//     qDebug() << "username:" << username << endl;
//     qDebug() << "password:" << password << endl;
     if (username == "" || password == "") {
         qDebug() << "账号密码不能为空" << endl;
     }else {
         if(username == "jiang" && password == "123456") {
             qDebug() << "登陆成功" << endl;
         }else {
             qDebug() << "error 账号密码不匹配" << endl;
         }
     }
}

void MainWindow::on_username_textChanged(const QString &arg1)
{
    username = arg1;
}

void MainWindow::on_password_textChanged(const QString &arg1)
{
    password = arg1;
}
